package cn.iocoder.yudao.module.system.util;

import java.nio.charset.Charset;
import java.util.Base64;

/**
 * @Description: tokenId加密规则
 * @Author: meiwanli
 * @Date: 2025-09-25 9:25
 */
public class JiaMi {
    public static void main(String[] args) {
        String base64 = Base64("NVWA", "c4c0295d0e7c499ebc36813637cfeb16");
        System.out.println(base64);
    }

    /**
     *
     * @param code cs认证中心的标识,传"NVWA"
     * @param value 传tokenId
     * @return
     */
    public static String Base64(String code, String value) {
        Charset utf8 = Charset.forName("utf8");
        String authorizationText = String.format("%s:%s", code,value);
        byte[] authorizationByte = authorizationText.getBytes(utf8);
        return new String(Base64.getEncoder().encode(authorizationByte), utf8);
    }
}
